/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package kipcorn;

import generated.MazeCom;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.SocketException;
import networking.MazeComMessageFactory;
import networking.XmlInStream;
import networking.XmlOutStream;

/**
 *
 * @author rebecca.badziong
 */
public class KIpcorn {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) throws EOFException, SocketException, IOException {
	MazeCom loginMsg = new MazeCom();
	MazeComMessageFactory maz = new MazeComMessageFactory();
	loginMsg = maz.createLoginMessage("Kipcornssrsnr");
		
        Socket serverSocket = new Socket("localhost",5123);
		
        OutputStream outStream = serverSocket.getOutputStream();
        InputStream inStream = serverSocket.getInputStream();
        
        XmlOutStream out = new XmlOutStream(outStream);
        XmlInStream in = new XmlInStream(inStream);
	out.write(loginMsg);
        MazeCom test = in.readMazeCom();
        System.out.println(test.getLoginReplyMessage());
	}
	
}
